export const getBtnAttr = btnInfo => {
  if (btnInfo && btnInfo.btnType) {
    let btn = {}
    switch (btnInfo.btnType) {
      case 'post':
        btn = { name: '新增', icon: 'el-icon-plus', type: 'primary', className: '' }
        break
      case 'put':
        btn = { name: '修改', icon: 'el-icon-edit', type: 'warning', className: '' }
        break
      case 'get':
        btn = { name: '查看', icon: 'el-icon-view', type: 'success', className: '' }
        break
      case 'delete':
        btn = { name: '删除', icon: 'el-icon-delete', type: 'danger', className: '' }
        break
      case 'draw':
        btn = { name: '绘制地图', icon: 'el-icon-edit', type: 'danger', className: '.btn-style-byself-cornflowerblue' }
        break
      case 'divide_area':
        btn = { name: '划分区域', icon: 'el-icon-extend-bianji1', type: 'danger', className: '.btn-style-byself-cornflowerblue' }
        break
      case 'check_area':
        btn = { name: '查看区域', icon: 'el-icon-view', type: 'danger', className: '.btn-style-byself-cornflowerblue' }
        break
      case 'reset':
        btn = { name: '重置密码', icon: 'el-icon-extend-47', type: 'danger', className: '.btn-style-byself-cornflowerblue' }
        break
      case 'print':
        btn = { name: '打印', icon: 'el-icon-plus', type: 'danger', className: '.btn-style-byself-cornflowerblue' }
        break
      case 'educe':
        btn = { name: '导出', icon: 'iconfont el-icon-extend-daochu', type: 'danger', className: '.btn-style-byself-cornflowerblue' }
        break
      case 'into':
        btn = { name: '导入', icon: 'el-icon-plus', type: 'danger', className: '.btn-style-byself-cornflowerblue' }
        break
      case 'mark':
        btn = { name: '地图标注', icon: 'el-icon-plus', type: 'danger', className: '.btn-style-byself-cornflowerblue' }
        break
      case 'set_power':
        btn = { name: '设置权限', icon: 'el-icon-plus', type: 'danger', className: '.btn-style-byself-cornflowerblue' }
        break
      case 'set_permission_code':
        btn = { name: '设置权限码', icon: 'el-icon-plus', type: 'danger', className: '.btn-style-byself-cornflowerblue' }
        break
      case 'approve':
        btn = { name: '审核', icon: 'iconfont el-icon-extend-bianji1', type: 'danger', className: '.btn-style-byself-cornflowerblue' }
        break
      case 'not_approve':
        btn = { name: '审核不通过', icon: 'el-icon-plus', type: 'danger', className: '.btn-style-byself-cornflowerblue' }
        break
      case 'recommend':
        btn = { name: '推荐审核', icon: 'el-icon-plus', type: 'danger', className: '.btn-style-byself-cornflowerblue' }
        break
      case 'not_recommend':
        btn = { name: '不推荐', icon: 'el-icon-plus', type: 'danger', className: '.btn-style-byself-cornflowerblue' }
        break
      case 'town_recommend':
        btn = { name: '乡镇推荐', icon: 'el-icon-plus', type: 'danger', className: '.btn-style-byself-cornflowerblue' }
        break
      case 'point_changed':
        btn = { name: '积分变动', icon: 'el-icon-plus', type: 'danger', className: '.btn-style-byself-cornflowerblue' }
        break
      case 'manage':
        btn = { name: '矛盾处理', icon: 'iconfont el-icon-extend-bianji1', type: '', className: 'btn-style-byself-deadgreen' }
        break
      case 'check_flow':
        btn = { name: '查看流程监控', icon: 'iconfont el-icon-extend-sousuo', type: '', className: 'btn-style-byself-yellowgreen' }
        break
      case 'add_user':
        btn = { name: '新增用户', icon: 'iconfont el-icon-extend-jia', type: '', className: 'btn-style-byself-yellowgreen' }
        break
      case 'user_config':
        btn = { name: '用户配置', icon: 'iconfont el-icon-extend-jia', type: '', className: 'btn-style-byself-yellowgreen' }
        break
      case 'set_authorizationCode':
        btn = { name: '设置授权码', icon: 'iconfont el-icon-extend-bianji', type: '', className: 'btn-style-byself-yellowgreen' }
        break
      case 'set_overdue':
        btn = { name: '设置逾期', icon: 'iconfont el-icon-extend-bianji', type: '', className: 'btn-style-byself-cornflowerblue' }
        break
      case 'set_responsibility':
        btn = { name: '设置职责不明', icon: 'iconfont el-icon-extend-bianji', type: '', className: 'btn-style-byself-green' }
        break
      case 'set_publicity':
        btn = { name: '设置公示/不公示', icon: 'iconfont el-icon-extend-bianji', type: '', className: 'btn-style-byself-red' }
        break
      case 'set_important':
        btn = { name: '设置重要/一般事件', icon: 'iconfont el-icon-extend-bianji', type: '', className: 'btn-style-byself-purple' }
        break
      case 'set_distinction':
        btn = { name: '推荐优秀', icon: 'iconfont el-icon-extend-bianji', type: '', className: 'btn-style-byself-yellowgreen' }
        break
      case 'evaluationn':
        btn = { name: '考核评价', icon: 'iconfont el-icon-extend-bianji', type: '', className: 'btn-style-byself-yellowgreen' }
        break
      case 'publishing_Notices':
        btn = { name: '发布通知', icon: 'iconfont el-icon-extend-bianji2', type: '', className: 'btn-style-byself-yellowgreen' }
        break
      default:
        console.error('没有找到方法, btnType = ' + btnInfo.method)
        break
    }
    btn.btnType = btnInfo.btnType
    btn.uri = btnInfo.uri
    return btn
  } else {
    console.log('Btninfo is empty!')
    return null
  }
}
